#'
#' @TODO 列注释点图
#' @title 列注释点图
#' @description 列注释点图
#' @param dat 输入数据
#' @param .x *character*，x轴数据 
#' @param .y *character*，y轴数据 
#' @param ... 可变长参数，映射数据,比如说'fill = r','size = -log0(P)'
#' @param .anno_col *character*，y轴注释信息所在列名
#' @param p_name 图片名字 
#' @param od 输出路径
#' @param w 图宽
#' @param h 图高 
#' @return ggplot对象
#' @export 
#' 
#' @author *WYK*
Ponit_Anno_Plot <- function(dat = NULL, .x = NULL, .y = NULL, ..., .anno_col = NULL, p_name = NULL, od = NULL, w = 7, h = 7) {
    library(tidyverse)
    library(jjAnno)

    # paras <- list('fill = color','size = shape')
    paras <- list(...)
    expr_text <- str_c(paras,collapse = ',') %>% as.character()    

    p <- dat %>%
        ggplot(aes(x = get0(.x), y = get0(.y))) +
        geom_point(aes(eval(parse(expr_text))), shape = 21, color = "black") +
        theme_bw(14) +
        scale_y_discrete(position = "right") +
        theme(
            axis.title.y = element_blank(),
            axis.title.x.bottom = element_blank(), panel.grid = element_blank(),
            axis.text = element_text(color = "black"),
            plot.background = element_rect(fill = NULL, inherit.blank = T),
            axis.text.x.bottom = element_text(angle = 45, hjust = 1, vjust = 1.1),
            legend.position = "top"
        ) +
        scale_fill_gradient2(
            low = muted("green"),
            mid = "white",
            high = muted("purple"),
            name = "r",
            limits = c(-1, 1)
        ) +
        theme(plot.margin = margin(.1, .1, .1, 7.2, unit = "cm")) +
        coord_cartesian(clip = "off")

    P2 <- annoSegment(
        object = p,
        annoPos = "left",
        aesGroup = T,
        aesGroName = .anno_col,
        xPosition = -.5,
        segWidth = 0.5,
        addText = T,
        textRot = 0,
        textHVjust = -0.4,
        hjust = 1,
        textSize = 12
    )
    plotout(p = P2, od = od, name = p_name, w = w, h = h)

    return(P2)
}
